/**
 * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package work.konbai.basic.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import work.konbai.basic.entity.Course;
import work.konbai.basic.entity.CourseStudent;
import work.konbai.basic.mapper.CourseStudentMapper;
import work.konbai.basic.service.ICourseStudentService;
import work.konbai.basic.vo.CourseStudentVO;
import work.konbai.basic.vo.MemberVO;

/**
 * 课程-学生 关联信息表 服务实现类
 *
 * @author KonBAI
 * @since 2021-02-05
 */
@Service
public class CourseStudentServiceImpl extends BaseServiceImpl<CourseStudentMapper, CourseStudent> implements ICourseStudentService {

	/**
	 * 分页 查询已拥有课程信息表
	 * @param page 分页信息
	 * @param studentId 学生ID
	 * @return 已拥有课程信息列表
	 */
	@Override
	public IPage<CourseStudentVO> ownPage(IPage<CourseStudentVO> page, Long studentId) {
		return page.setRecords(baseMapper.selectOwnPage(page, studentId));
	}

	/**
	 * 分页 查询可选课程信息表
	 * @param page 分页信息
	 * @param studentId 学生ID
	 * @return 可选课程信息列表
	 */
	@Override
	public IPage<Course> optionalPage(IPage<Course> page, Long studentId) {
		return page.setRecords(baseMapper.selectOptionalPage(page, studentId));
	}

	/**
	 * 分页 查询课程成员信息表
	 * @param page 分页信息
	 * @param courseId 课程ID
	 * @return 课程成员信息列表
	 */
	@Override
	public IPage<MemberVO> memberPage(IPage<MemberVO> page, Long courseId) {
		return page.setRecords(baseMapper.selectMemberPage(page, courseId));
	}
}
